﻿// <auto-generated />
using System;
using System.Reflection;
using AutoLot.Samples.ViewModels;
using Microsoft.EntityFrameworkCore.Metadata;

#pragma warning disable 219, 612, 618
#nullable disable

namespace AutoLot.Samples.CompiledModels
{
    partial class CarMakeViewModelEntityType
    {
        public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null)
        {
            var runtimeEntityType = model.AddEntityType(
                "AutoLot.Samples.ViewModels.CarMakeViewModel",
                typeof(CarMakeViewModel),
                baseEntityType);

            var carId = runtimeEntityType.AddProperty(
                "CarId",
                typeof(int),
                propertyInfo: typeof(CarMakeViewModel).GetProperty("CarId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                fieldInfo: typeof(CarMakeViewModel).GetField("<CarId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
            carId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);

            var color = runtimeEntityType.AddProperty(
                "Color",
                typeof(string),
                propertyInfo: typeof(CarMakeViewModel).GetProperty("Color", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                fieldInfo: typeof(CarMakeViewModel).GetField("<Color>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                nullable: true,
                maxLength: 50);
            color.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);

            var dateBuilt = runtimeEntityType.AddProperty(
                "DateBuilt",
                typeof(DateTime),
                propertyInfo: typeof(CarMakeViewModel).GetProperty("DateBuilt", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                fieldInfo: typeof(CarMakeViewModel).GetField("<DateBuilt>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
            dateBuilt.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);

            var display = runtimeEntityType.AddProperty(
                "Display",
                typeof(string),
                propertyInfo: typeof(CarMakeViewModel).GetProperty("Display", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                fieldInfo: typeof(CarMakeViewModel).GetField("<Display>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                nullable: true,
                maxLength: 50);
            display.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);

            var isDrivable = runtimeEntityType.AddProperty(
                "IsDrivable",
                typeof(bool),
                propertyInfo: typeof(CarMakeViewModel).GetProperty("IsDrivable", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                fieldInfo: typeof(CarMakeViewModel).GetField("<IsDrivable>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
            isDrivable.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);

            var make = runtimeEntityType.AddProperty(
                "Make",
                typeof(string),
                propertyInfo: typeof(CarMakeViewModel).GetProperty("Make", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                fieldInfo: typeof(CarMakeViewModel).GetField("<Make>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                nullable: true,
                maxLength: 50);
            make.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);

            var makeId = runtimeEntityType.AddProperty(
                "MakeId",
                typeof(int),
                propertyInfo: typeof(CarMakeViewModel).GetProperty("MakeId", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                fieldInfo: typeof(CarMakeViewModel).GetField("<MakeId>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly));
            makeId.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);

            var petName = runtimeEntityType.AddProperty(
                "PetName",
                typeof(string),
                propertyInfo: typeof(CarMakeViewModel).GetProperty("PetName", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                fieldInfo: typeof(CarMakeViewModel).GetField("<PetName>k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly),
                nullable: true,
                maxLength: 50);
            petName.AddAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.None);

            return runtimeEntityType;
        }

        public static void CreateAnnotations(RuntimeEntityType runtimeEntityType)
        {
            runtimeEntityType.AddAnnotation("Relational:FunctionName", null);
            runtimeEntityType.AddAnnotation("Relational:Schema", null);
            runtimeEntityType.AddAnnotation("Relational:SqlQuery", "\r\n                SELECT m.Id MakeId, m.Name Make, i.Id CarId, i.IsDrivable, \r\n                   i.DisplayName, i.DateBuilt, i.Color, i.PetName\r\n                FROM dbo.Makes m \r\n                INNER JOIN dbo.Inventory i ON i.MakeId = m.Id");
            runtimeEntityType.AddAnnotation("Relational:TableName", "blank");
            runtimeEntityType.AddAnnotation("Relational:ViewName", null);
            runtimeEntityType.AddAnnotation("Relational:ViewSchema", null);

            Customize(runtimeEntityType);
        }

        static partial void Customize(RuntimeEntityType runtimeEntityType);
    }
}
